home *** CD-ROM | disk | FTP | other *** search
- Path: news.mindlink.net!giant!a09748
- From: a09748@giant.mindlink.bc.ca (ESSA)
- Newsgroups: comp.os.ms-windows.programmer.tools.mfc,comp.lang.c++,comp.lang.basic.visual.misc
- Subject: Prob calling VC++ 4.0 DLL from VB4 (32bit)
- Date: 6 Feb 1996 16:05:37 GMT
- Organization: MIND LINK! - British Columbia, Canada
- Message-ID: <4f7u8h$63q@fountain.mindlink.net>
- NNTP-Posting-Host: giant.mindlink.net
- X-Newsreader: TIN [version 1.2 PL2]
-
-
- Having a frustrating time trying to call a function in a DLL developed in
- VC++ 4.0 from Visual Basic 4.0 (32bit). I'm getting VB error 49 (bad DLL
- calling convention) from the following simple function ...
-
- In mydll.h
- #define DllExport __declspec(dllexport)
- extern "C" long DllExport TestLongParam(long lParam);
-
- In mydll.cpp
- extern "C" long DllExport TestLongParam(long lParam)
- {
- TRACE("TestLongParam called with %ld\n", lParam);
- return(1L);
- }
-
- The Declare in VB is
- Declare Function TestLongParam Lib "MYDLL.DLL" (ByVal lParam As Long) As Long
-
- When I call TestLongParam from VB, I get the TRACE output with the correct
- value for the passed parameter, but on return, VB gives error 49.
-
- Can anyone sugesst what is wrong with the way I have declared the functions ?
- I have played around with the __stdcall modifier, the WINAPI macro and even
- tried the old obsolete FAR PASCAL with no success.
-
- Thx
-
- ---
- pwhiteside@essa.com
-